cmake_minimum_required(VERSION 3.14)

project(ORNL_TCP_Sockets LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)

find_package(QT NAMES Qt5 COMPONENTS Network REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)

file(GLOB_RECURSE SOURCES "src/**.cpp")
file(GLOB_RECURSE HEADERS "include/**.h")

add_library(ORNL_TCP_Sockets STATIC
  ${SOURCES}
  ${HEADERS}
)

target_link_libraries(ORNL_TCP_Sockets Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network)

target_compile_definitions(ORNL_TCP_Sockets PRIVATE ORNLTCPSOCKETS_LIBRARY)

set(ORNL_TCP_SOCKETS_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
set(ORNL_TCP_SOCKETS_LIB ORNL_TCP_Sockets PARENT_SCOPE)
